{% extends "analysis_plugins/general_information.html" %}

{% block styles %}
    <link type="text/css" href="{{ url_for('static', filename='css/code_pre.css') }}" rel="stylesheet">
{% endblock %}

{% macro result_list(result_list) %}
    {% for item in result_list %}
        <ul class="m-0">
            <li>{{ item['path'] }}</li>
        </ul>
    {% endfor %}
{% endmacro %}

{% block analysis_result_details %}

    {% for category, category_result in analysis_result.items() %}
        {% if category_result %}
            <tr>
                <td>
                    {{ category }}
                </td>
                <td class="p-0">
                    {% for artifact, artifact_data in (category_result | group_dict_list_by_key('name')).items() %}
                        <table style="width: 100%">
                            <tr>
                                <td style="width: 10%; min-width: 100px;">{{ artifact }}</td>
                                <td>
                                    {# hide long results in a <details> block #}
                                    {% if artifact_data | length > 10 %}
                                        <details>
                                            <summary>show details</summary>
                                            {{ result_list(artifact_data) }}
                                        </details>
                                    {% else %}
                                        {{ result_list(artifact_data) }}
                                    {% endif %}
                                </td>
                            </tr>
                        </table>
                    {% endfor %}
                </td>
            </tr>
        {% endif %}
    {% endfor %}

{% endblock %}
